package com.ete.service.manager

import android.util.SparseArray
import com.blankj.utilcode.util.NetworkUtils

/**
 * Author:LiXian
 * <p>
 * Desc:常量
 * Version:1.0
 * date 2024/1/8 13:52
 */
object ManagerConstant {

    //正式环境
    const val RELEASE_BASE_URL = "https://device-api-pt.shjkkc.com/"

    //测试环境
    const val TEST_BASE_URL = "https://device-api-pt-test.shjkkc.com/"

    const val TIME_THIRTY_SECOND = 30L
    const val TIME_FIVE_MINUTE = 5 * 60L
    const val SYMBOL_SLASH = "/"

    /**
     * 压缩包后缀
     */
    const val ZIP_FILE_EXTENSION = "zip"

    /**
     * 设备类型 1、主机 2、单机
     */
    const val UPLOAD_TYPE_HOST = 1
    const val UPLOAD_TYPE_SUB = 2

    /**
     * 硬件使用状态 1-正常（启动）  2-禁用
     */
    const val HARDWARE_DEVICE_STATE_NORMAL = 1
    const val HARDWARE_DEVICE_STATE_BANNED = 2

    /**
     * 硬件上传状态 0-未上传  1-已上传
     */
    var HARDWARE_UNLOADED = 0
    var HARDWARE_UPLOADED = 1

    /**
     * 设备连接类型 1、2.4G 2、BLE蓝牙 3、涂鸦 4、5.8G 99、其他
     */
    const val CONNECT_TYPE_24G = 1
    const val CONNECT_TYPE_BLE = 2
    const val CONNECT_TYPE_TUYA = 3
    const val CONNECT_TYPE_58G = 4
    const val CONNECT_TYPE_OTHER = 99

    /**
     * 错误标示
     */
    const val ERROR_ONT_PERMISSION = -1
    const val ERROR_ONT_SCR_FILE = -2
    const val ERROR_ZIP_EXCEPTION = -3

    /**
     * apkURL秘钥
     */
    const val APK_URL_SECRET_KEY = "T7wrvVHudD2YTYIlM4oO9"

    /**
     * 发布类型:版本类型 1强制更新、2强提醒、3弱提醒, 目前APP都是弱提示
     */
    const val RELEASE_TYPE_VERSION_FORCE = "1"
    const val RELEASE_TYPE_VERSION_STRONG = "2"
    const val RELEASE_TYPE_VERSION_WEAK = "3"

    /**
     * 时间格式
     */
    const val TIME_FORMAT_FULL = "yyyy-MM-dd HH:mm:ss"

    /**
     * 移动网络
     */
    val NETWORK_CELLULARS = listOf(
            NetworkUtils.NetworkType.NETWORK_2G,
            NetworkUtils.NetworkType.NETWORK_3G,
            NetworkUtils.NetworkType.NETWORK_4G,
            NetworkUtils.NetworkType.NETWORK_5G,
    )

    //成功
    const val CODE_SUCCESS = 0

    //错误码集合
    val ERROR_CODE: SparseArray<String> = SparseArray()

    /*************定位错误码******************/
    const val CODE_NOT_INIT = -1
    const val CODE_NOT_PERMISSION = -2
    const val CODE_NOT_GEO_KEY = -3
    const val CODE_NOT_SUPPORT_LOCATION = -5
    const val CODE_GPS_UNENABLED = -6
    const val CODE_NAVIGATION_OPEN_GPS = -7
    const val CODE_NOT_GPS_MODE = -8

    /*GPS串口定位*/
    const val GPS_LOCATION_BAUD_RATE = 9600
    const val GPS_LOCATION_SERIAL_PATH = "/dev/ttyS9"
    const val GPS_DEFAULT_ADDRESS = 999.9

    init {
        //定位错误码
        ERROR_CODE.put(CODE_SUCCESS, "操作成功")
        ERROR_CODE.put(CODE_NOT_INIT, "未初始化")
        ERROR_CODE.put(CODE_NOT_PERMISSION, "权限检查未通过")
        ERROR_CODE.put(CODE_NOT_GEO_KEY, "高德KEY为空")
        ERROR_CODE.put(CODE_NOT_SUPPORT_LOCATION, "不支持定位")
        ERROR_CODE.put(CODE_GPS_UNENABLED, "GPS未打开")
        ERROR_CODE.put(CODE_NAVIGATION_OPEN_GPS, "跳转打开GPS功能")
        ERROR_CODE.put(CODE_NOT_GPS_MODE, "此设备无GPS模块")
    }
}